package json

import (
	json "github.com/json-iterator/go"
)

func Encode(v interface{}) ([]byte, error) {
	return json.Marshal(v)
}

func Decode(stack []byte, v interface{}) error {
	return json.Unmarshal(stack, &v)
}

func EncodeString(v interface{}) (string, error) {
	b, err := Encode(v)
	if err != nil {
		return "", err
	}
	return Byte2String(b), nil
}
